﻿Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class DataProvider
    Public Shared Function ConnectSQl() As SqlConnection
        Dim connectionString As String
        connectionString = "Data Source=DUONGAN-PC;Initial Catalog=QLTHUVIEN;Integrated Security=True"
        Dim conn As New SqlConnection(connectionString)
        conn.Open()
        Return conn
    End Function

    Public Shared Function ExecuteQuery(ByVal strSql As String) As DataTable
        Dim restable As New DataTable()
        Dim _con As SqlConnection = ConnectSQl()
        Dim adapter As SqlDataAdapter = New SqlDataAdapter(strSql, _con)
        adapter.Fill(restable)
        Return restable
    End Function
End Class
